//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_FLOPPY_H__
#define __ELASTOS_FLOPPY_H__

static DzEvent* peFloppy;

#include "fd_reg.h"

class FloppyDriver : public CDeviceDriver
{
public:
    CARAPI Read(
        /* [in] */ Int64 u64Offset,
        /* [in] */ Int32 bytesToRead,
        /* [out] */ EzByteBuf buffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */ Int64 u64Offset,
        /* [in] */ EzByteBuf buffer,
        /* [out] */ Int32 * pBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */ Handle32 nControlCode,
        /* [in] */ EzByteBuf inBuffer,
        /* [out] */ EzByteBuf * pOutBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    virtual void Dispose();

public:
    ECode Initialize();

    void Isr();

    physaddr_t m_paDMABuffer;
    virtaddr_t m_vaDMABuffer;

    uint_t  m_uHeads;
    uint_t  m_uTracks;
    uint_t  m_uSectorsPerTracks;
    uint_t  m_uSectors;
};

#endif  //__ELASTOS_FLOPPY_H__
